home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / smail-3.1.28 / src / smail.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-11  |  1.8 KB  |  64 lines

  1. /* @(#)src/smail.h    1.5 7/11/92 11:50:56 */
  2.  
  3. /*
  4.  *    Copyright (C) 1987, 1988 Ronald S. Karr and Landon Curt Noll
  5.  *    Copyright (C) 1992  Ronald S. Karr
  6.  * 
  7.  * See the file COPYING, distributed with smail, for restriction
  8.  * and warranty information.
  9.  */
  10.  
  11. /*
  12.  * smail.h:
  13.  *    miscellaneous macros used in the smail source files.
  14.  *
  15.  */
  16.  
  17. /* #defines for general use */
  18. #ifdef    NULL                /* make sure NULL is 0 */
  19. # undef NULL
  20. #endif
  21. #define NULL    0
  22. #define TRUE    1           /* All true wisdom is found on T-shirts */
  23. #define FALSE    0            /* This fortune is false */
  24. #define SUCCEED    0            /* function succeeded */
  25. #define FAIL    (-1)            /* function failed */
  26. #define SIZE_FILNAM    300        /* Size used for J-random filenames */
  27. #define EQ(a,b)    (strcmp((a),(b)) == 0)    /* TRUE if strings a and b equal */
  28. #define EQIC(a,b) (strcmpic((a),(b)) == 0) /* EQ but case is insignificant */
  29. /*
  30.  * compare a string with a header field to see if names match
  31.  * return TRUE if match, FALSE if no match
  32.  */
  33. #define HDREQ(s,h)    (!strncmpic((s), (h), strlen((s))) &&    \
  34.              ((h)[strlen((s))] == ':' ||        \
  35.               isspace((h)[strlen((s))])))
  36. /*
  37.  * size for various names used in the configuration tables read from
  38.  * the startup file, or compiled in with default.c.
  39.  */
  40. #define    CONFIG_NAMSIZ    16        /* 15 chars plus a nul byte */
  41.  
  42. /*
  43.  * return the integer offset from the start of a given structure type
  44.  * to a given tag.
  45.  */
  46. #define OFFSET(type, tag) \
  47.     (int)((char *)(&((struct type *)0)->tag) - (char *)(struct type *)0)
  48.  
  49. /* return the number of elements in an array. */
  50. #define TABLESIZE(table) \
  51.     (sizeof(table)/sizeof((table)[0]))
  52.  
  53. /* return a pointer to the end of a table. */
  54. #define ENDTABLE(table) \
  55.     ((table) + TABLESIZE(table))
  56.  
  57. /*
  58.  * types for general use
  59.  */
  60. struct list {                /* general purpose list entry */
  61.     struct list *succ;            /* single forward link */
  62.     char *text;                /* data associated with entry */
  63. };
  64.